//
//  YMServiceManager.h
//  YMIM
//
//  Created by reyzhang on 2022/3/18.
//

#import <Foundation/Foundation.h>
#import "YMNetworkUtils.h"
#import "YMCommonDefs.h"

NS_ASSUME_NONNULL_BEGIN

//返回数据的key
extern NSString *const kResponseDataKey;


/*****************************************************/
//绑定推送clientId
extern NSString *const BindPushGTClientId;
//创建单聊,私聊
extern NSString *const CreatePrivateChat;
//发送消息
extern NSString *const SendMessage;
//创建群组
extern NSString *const CreateGroup;
//群组列表，会话列表
extern NSString *const GroupList;
//群组详情
extern NSString *const GroupDetail;
//解散群组
extern NSString *const DismissGroup;
//邀请进群
extern NSString *const InviteToJoinGroup;
//删除会话
extern NSString *const RemoveConversation;
//群组消息免打扰
extern NSString *const DisturbGroup;
//请离群组中的用户
extern NSString *const KickUsersOfGroup;
//离开群组
extern NSString*const LeaveGroup;
//修改群组名称
extern NSString *const UpdateGroupName;
//设置群组置顶
extern NSString *const SetupGroupToTop;
//修改用户资料
extern NSString *const UpdateUserInfo;
//未读消息数量
extern NSString *const UnreadMessageCount;
/*******************好友相关**********************************/
//好友列表
extern NSString *const FriendList;
//申请列表
extern NSString *const FriendApplyList;
//添加好友
extern NSString *const AddFriend;
//删除好友
extern NSString *const DeleteFriend;
//好友详情
extern NSString *const FriendDetail;
//处理申请
extern NSString *const HandleFriendApply;
//好友备注
extern NSString *const FriendNote;
//搜索用户
extern NSString *const SearchUser;

//******************聊天室相关*********************************
//创建聊天室
extern NSString *const CreateRoom;
//加入聊天室
extern NSString *const JoinRoom;
//请离聊天室
extern NSString *const KickRoom;
//离开聊天室
extern NSString *const LeaveRoom;
//邀请进入聊天室
extern NSString *const InviteRoom;
//解散聊天室
extern NSString *const DismissRoom;
//禁言用户
extern NSString *const UserForbiddenInRoom;
//解禁用户
extern NSString *const UserLiftaBanInRoom;



/*****************************************************/
//消息列表
extern NSString *const MessageList;
//文件上传 (语音文件，图片文件，视频文件)
extern NSString *const FileUpload;
//清空聊天消息
extern NSString *const ClearMessage;



/**
 * 接口服务
 */
@interface YMServiceManager : NSObject

#pragma mark - 绑定推送clientId
/**
 绑定推送clientId
 */
+(void)bindPushGTClientId:(NSString *)clientId withUserId:(NSString *)userId success:(YMSuccessBlock)YMSuccessBlock
    failure:(YMFailureBlock)YMFailureBlock;


#pragma mark - 群组相关
/**
 与目标用户建立单聊
 @label 标签，分组会话
 */
+ (void)createPrivateChatWithTargetId:(NSString *)tid
                                label:(NSInteger)label
                              success:(YMSuccessBlock)YMSuccessBlock
                              failure:(YMFailureBlock)YMFailureBlock;



/**
 发送消息
 */
+ (void)sendMessageWithGroupId:(NSString *)groupId
                       message:(NSString *)message
                   messageType:(YMMessageType)messageType
                     extraData:(NSDictionary *)extraData
                      success:(YMSuccessBlock)YMSuccessBlock
                      failure:(YMFailureBlock)YMFailureBlock;



/**
 创建群组。
 @label标签，可以用来区分
 @uids 群组用户， 多用户之间用,号分割
 */
+ (void)createGroupWithName:(NSString *)name
                   portrait:(NSString *)portrait
                       uids:(NSString *)uids
                      label:(NSInteger)label
                    success:(YMSuccessBlock)YMSuccessBlock
                    failure:(YMFailureBlock)YMFailureBlock;

/**
 群组列表,会话列表
 @types 会话类型，多种会话类型之间用,号分割
 */
+ (void)groupListWithPage:(NSInteger)page
                 pageSize:(NSInteger)pageSize
                groupType:(NSString *)types
                    label:(NSInteger)label
                 queryStr:(NSString *)queryStr
                  success:(YMSuccessBlock)YMSuccessBlock
                  failure:(YMFailureBlock)YMFailureBlock;


/**
 获取群组详情
 */
+ (void)getGroupDetailWithGroupId:(NSString *)groupId
                        success:(YMSuccessBlock)YMSuccessBlock
                        failure:(YMFailureBlock)YMFailureBlock;


/**
 解散群组
 */
+ (void)dismissGroupWithGroupId:(NSString *)groupId
                        success:(YMSuccessBlock)YMSuccessBlock
                        failure:(YMFailureBlock)YMFailureBlock;

/**
 邀请进群
 */
+ (void)inviteToJoinGroupWithGroupId:(NSString *)groupId
                             uidList:(NSArray<NSString *> *)uidList
                             success:(YMSuccessBlock)YMSuccessBlock
                             failure:(YMFailureBlock)YMFailureBlock;


/**
 删除会话，只针对当前用户。有新的消息来时，会话还会显示
 */
+ (void)removeConversationWithGroupId:(NSString *)groupId
                              success:(YMSuccessBlock)YMSuccessBlock
                              failure:(YMFailureBlock)YMFailureBlock;

/**
 设置群组的消息免打扰
 */
+ (void)disturbGroupWithGroupId:(NSString *)groupId
                        success:(YMSuccessBlock)YMSuccessBlock
                        failure:(YMFailureBlock)YMFailureBlock;

/**
 从群组中请离用户, 创建群组的群主有权限请离用户
 @groupId 群组ID
 @uidList 请离用户,用户数组
 */
+ (void)kickUsersWithGroupId:(NSString *)groupId
                     uidList:(NSArray<NSString *> *)uidList
                     success:(YMSuccessBlock)YMSuccessBlock
                     failure:(YMFailureBlock)YMFailureBlock;


/**
 用户主动离开群组
 */
+ (void)leaveGroupWithGroupId:(NSString *)groupId
                      success:(YMSuccessBlock)YMSuccessBlock
                      failure:(YMFailureBlock)YMFailureBlock;


/**
 修改群组名称
 @groupName: 新的群组名称
 */
+ (void)updateGroupNameWithGroupId:(NSString *)groupId
                         groupName:(NSString *)groupName
                           success:(YMSuccessBlock)YMSuccessBlock
                           failure:(YMFailureBlock)YMFailureBlock;


/**
 设置群组置顶
 */
+ (void)setupGroupToTopWithGroupId:(NSString *)groupId
                       success:(YMSuccessBlock)YMSuccessBlock
                       failure:(YMFailureBlock)YMFailureBlock;

#pragma mark  - 消息相关

/**
 获取群组消息
 */
+ (void)messageListWithGroupId:(NSString *)groupId
                          page:(NSInteger)page
                      pageSize:(NSInteger)pageSize
                      queryStr:(NSString *)queryStr
                       success:(YMSuccessBlock)YMSuccessBlock
                       failure:(YMFailureBlock)YMFailureBlock;


/**
 文件上传
 */
+ (void)uploadWithFiles:(NSArray *)files
               progress:(void(^)(int progress))progressBlock
                success:(YMSuccessBlock)YMSuccessBlock
                failure:(YMFailureBlock)YMFailureBlock;


/**
 修改用户信息
 */
+ (void)updateUserInfoWithUserId:(NSString *)uid
                            name:(NSString *)name
                          avatar:(NSString *)avatar
                         success:(YMSuccessBlock)YMSuccessBlock
                         failure:(YMFailureBlock)YMFailureBlock;

/**
 未读消息数量
 */
+ (void)unreadMessageCountWithSuccess:(YMSuccessBlock)YMSuccessBlock
                              failure:(YMFailureBlock)YMFailureBlock;


/**
 清空聊天消息
 */
+ (void)clearMessageWithGroupId:(NSString *)groupId
                        success:(YMSuccessBlock)YMSuccessBlock
                        failure:(YMFailureBlock)YMFailureBlock;


#pragma mark - 好友相关

/**
 好友列表
 */
+ (void)getFriendsListWithQueryStr:(NSString *)queryStr
                           success:(YMSuccessBlock)YMSuccessBlock
                           failure:(YMFailureBlock)YMFailureBlock;

/**
 好友申请列表
 */
+ (void)getFriendsApplyListWithPage:(NSInteger)page
                           pageSize:(NSInteger)pageSize
                            success:(YMSuccessBlock)YMSuccessBlock
                            failure:(YMFailureBlock)YMFailureBlock;


/**
 申请添加好友
 */
+ (void)applyAddFriendWithTargetId:(NSString *)targetUserId
                      applyMessage:(NSString *)applyMessage
                           success:(YMSuccessBlock)YMSuccessBlock
                           failure:(YMFailureBlock)YMFailureBlock;


/**
 处理好友申请
 */
+ (void)handleFriendApplyWithApplyId:(NSString *)applyId
                             isAgree:(BOOL)isAgree
                             success:(YMSuccessBlock)YMSuccessBlock
                             failure:(YMFailureBlock)YMFailureBlock;


/**
 获取好友详情
 */
+ (void)getFriendDetailWithFriendId:(NSString *)friendId
                            success:(YMSuccessBlock)YMSuccessBlock
                            failure:(YMFailureBlock)YMFailureBlock;



/**
 添加好友备注
 */
+ (void)addFriendNoteWithFriendId:(NSString *)friendId
                             note:(NSString *)note
                          success:(YMSuccessBlock)YMSuccessBlock
                          failure:(YMFailureBlock)YMFailureBlock;

/**
 删除好友
 */
+ (void)deleteFriendWithFriendId:(NSString *)friendId
                         success:(YMSuccessBlock)YMSuccessBlock
                         failure:(YMFailureBlock)YMFailureBlock;


/**
 搜索用户
 */
+ (void)searchUserWithKeyword:(NSString *)keyword
                      success:(YMSuccessBlock)YMSuccessBlock
                      failure:(YMFailureBlock)YMFailureBlock;


#pragma mark - 聊天室相关
/**
 创建聊天室
 @label标签，可以用来区分
 @uids 群组用户， 多用户之间用,号分割
 */
+ (void)createRoomWithName:(NSString *)name
                   portrait:(NSString *)portrait
                       uids:(NSString *)uids
                      label:(NSInteger)label
                    success:(YMSuccessBlock)YMSuccessBlock
                    failure:(YMFailureBlock)YMFailureBlock;

/**
 解散聊天室
 */
+ (void)dismissRoomWithRoomId:(NSString *)roomId
                        success:(YMSuccessBlock)YMSuccessBlock
                        failure:(YMFailureBlock)YMFailureBlock;

/**
 邀请进入聊天室
 */
+ (void)inviteToJoinRoomWithRoomId:(NSString *)roomId
                             uidList:(NSArray<NSString *> *)uidList
                             success:(YMSuccessBlock)YMSuccessBlock
                             failure:(YMFailureBlock)YMFailureBlock;

/**
 从聊天室中请离用户, 创建聊天室的用户有权限请离用户
 @roomId 聊天室ID
 @uidList 请离用户,用户数组
 */
+ (void)kickUsersWithRoomId:(NSString *)roomId
                     uidList:(NSArray<NSString *> *)uidList
                     success:(YMSuccessBlock)YMSuccessBlock
                     failure:(YMFailureBlock)YMFailureBlock;


/**
 用户主动离开聊天室
 */
+ (void)leaveRoomWithRoomId:(NSString *)roomId
                      success:(YMSuccessBlock)YMSuccessBlock
                      failure:(YMFailureBlock)YMFailureBlock;



/**
 用户加入聊天室
 */
+ (void)joinRoomWithRoomId:(NSString *)roomId
                      success:(YMSuccessBlock)YMSuccessBlock
                      failure:(YMFailureBlock)YMFailureBlock;

/**
 用户禁言
 */
+ (void)muteRoomWithRoomId:(NSString *)roomId
                             uid:(NSString *)uid
                             success:(YMSuccessBlock)YMSuccessBlock
                             failure:(YMFailureBlock)YMFailureBlock;

/**
 用户解除禁言
 */
+ (void)unmuteRoomWithRoomId:(NSString *)roomId
                             uid:(NSString *)uid
                             success:(YMSuccessBlock)YMSuccessBlock
                             failure:(YMFailureBlock)YMFailureBlock;
/**
 聊天室搜索
 */
+ (void)roomListWithPage:(NSInteger)page
                 pageSize:(NSInteger)pageSize
                groupType:(NSString *)types
                    label:(NSInteger)label
                 queryStr:(NSString *)queryStr
                  success:(YMSuccessBlock)YMSuccessBlock
                  failure:(YMFailureBlock)YMFailureBlock;
@end

NS_ASSUME_NONNULL_END
